<template>
  <div>
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
      <el-table :data="rightsTableData" border>
        <el-table-column type="index" label="#" width="180"></el-table-column>
        <el-table-column
          prop="authName"
          label="权限名称"
          width="280"
        ></el-table-column>
        <el-table-column prop="path" label="路径" width="280"></el-table-column>
        <el-table-column prop="level" label="权限等级" width="280">
          <template slot-scope="scope">
            <el-tag type="danger"  effect="dark" v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag type="primary"  effect="dark" v-else-if="scope.row.level === '1'">二级</el-tag>
            <el-tag type="warning"  effect="dark" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script type="text/ecmascript-6">
import {requestRightsData} from '@/network/power.js'
export default {
    name: 'rights',
    data() {
        return {
            //传递的参数
            type: 'list',
            rightsTableData: []

        }
    },
    created(){
        this.getRightsData()
    },
    methods: {
        //获取网络请求数据函数
        async getRightsData(){
            const {data} = await requestRightsData({url: 'rights/'+ this.type})
            this.rightsTableData = data.data;


        }
    },
}
</script>

<style lang="less" scoped></style>
